package com.mcode.blog.vo.params;

import com.mcode.blog.config.ApiConfig;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;

import lombok.Data;


@Data
public class PageParams {

    @DecimalMin(value = "1", message = "pageNo参数必须大于0的数字")
    private int page = ApiConfig.PageNO;

    @DecimalMin(value = "1", message = "pageSize参数必须是大于0的数字")
    @DecimalMax(value = "60", message = "pageSize参数必须是小于60的数字")
    private int pageSize = ApiConfig.PageSize;

    private Long categoryId;

    private Long tagId;

    private String year;

    private String month;


    public String getMonth() {
        if (this.month != null && this.month.length() == 1) {
            return "0" + this.month;
        }
        return this.month;
    }

}
